package cn.dengta.webapp.trade.vo;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;

import cn.dengta.common.model.Messager;
import cn.dengta.common.util.Formats;
import cn.dengta.context.model.DateUnit;
import cn.dengta.webapp.base.vo.AbstractVO;
import cn.dengta.webapp.trade.model.Currency;
import cn.dengta.webapp.user.model.Gender;
import lombok.Getter;
import lombok.Setter;
import me.codeplayer.util.EasyDate;
import me.codeplayer.util.X;

@Getter
@Setter
public class RechargeVipLogVO extends AbstractVO<Void> {

	/** 用户ID */
	protected Long userId;
	protected Long agentId;
	public Map<String, Object> agent;
	/** 用户昵称 */
	protected String userNickname;
	/** VIP天数 */
	protected Integer vipDays;
	/** 价格 */
	protected BigDecimal price;
	/** 开通时间 */
	protected Date vipStartTime;
	/** 到期时间 */
	protected transient Date vipEndTime;
	/** 性别 */
	public transient Gender gender;
	/** 昵称 */
	public transient String nickname;
	/** 币种 */
	protected String currency;

	public String getGender_() {
		return X.map(gender, Gender::getLabel);
	}

	public String getVipMonths_() {
		return DateUnit.calcDesc(vipDays);
	}

	public String getVipStartTime_() {
		return Formats.formatDatetime(vipStartTime);
	}

	public String getCurrency_() {
		return X.map(Currency.of(currency), Currency::getLabel);
	}

	public String getVipEndTime_() {
		return vipStartTime != null && vipDays != null ? Formats.formatDatetime(new EasyDate(vipStartTime).addDay(vipDays).toDate()) : null;
	}

	public String getPrice_() {
		return Formats.formatNumber_D(price);
	}

}
